from django.db import models


# Create your models here.


class ErrorQuestion(models.Model):
    user_id = models.CharField(max_length=10)
    question_id = models.CharField(max_length=20)
    result = models.BooleanField(default=False)


class User_log(models.Model):
    user_id = models.CharField(max_length=10)
    right_number = models.IntegerField()
    wrong_number = models.IntegerField()
    time = models.DateTimeField(max_length=19)


class Question(models.Model):
    class Answer:
        A = 'A'
        B = 'B'
        C = 'C'
        D = 'D'

    CHOICE = 'CH'
    COMPLETION = 'COM'

    QUESTION_TYPE = [
        (CHOICE, "选择题"),
        (COMPLETION, "填空题")
    ]

    options = [
        (Answer.A, 'A'),
        (Answer.B, 'B'),
        (Answer.C, 'C'),
        (Answer.D, 'D')
    ]

    type = models.CharField('类型', max_length=10, choices=QUESTION_TYPE)
    title = models.CharField('问题内容', max_length=255)
    knowledge_point = models.CharField('知识点', max_length=255)
    chapter = models.CharField('章节', max_length=255)
    optionA = models.CharField('选项A的内容', max_length=255, blank=True, null=True)
    optionB = models.CharField('选项B的内容', max_length=255, blank=True, null=True)
    optionC = models.CharField('选项C的内容', max_length=255, blank=True, null=True)
    optionD = models.CharField('选项D的内容', max_length=255, blank=True, null=True)
    answer = models.CharField('问题答案', max_length=255)


class Temporary_completion(models.Model):
    question_id = models.CharField('题目的id', max_length=10)
    user_id = models.CharField('用户id', max_length=10)
    stu_answer = models.CharField('用户答案', max_length=255)








